package com.webside.wap.common.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.webside.wap.common.example.VideoExample;
import com.webside.wap.common.mapper.VideoMapper;
import com.webside.wap.common.service.BVideoService;
@Service("BVideoServiceimpl")
public class BVideoServiceImpl implements BVideoService {
	@Autowired
	VideoMapper videoDao;
	

	/**
	 * 根据传入的条件返回唯一video
	 * @param condition(id,seriesId,setNum)
	 * @return
	 */
	public List<VideoExample> selectVideoByCondition(Map<String,Object> condition){
		return 	videoDao.selectVideoByCondition(condition);
	}

	/**
	 * 根据video确定某一集
	 * 根据type决定改变哪列
	 * @param videoId
	 * @param Type
	 * @return
	 */
	public boolean updateSomeCount(String videoId, String type,String code) {
		Map<String,Object> condition = new HashMap<String,Object>();
		
		condition.put("id", videoId);
		condition.put("type", type);
		//暂时只统计状态正常的评论
		condition.put("status", 1);
		//code为修改的列的类型（现提供play_count comment_count like_count的修改）
		condition.put("code", code);
		
		int a = videoDao.updateCount(condition);
		if (a>0) {
			return true;
		}else{
			return false;
		}
	}
	
	
	



}
